PHP4 doesn't like null references, so splitting function
authorErik Moeller <erik@users.mediawiki.org>
Sat, 21 May 2005 17:26:42 +0000 (17:26 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Sat, 21 May 2005 17:26:42 +0000 (17:26 +0000)
includes/Article.php
includes/OutputPage.php

index 4f080c5..328cd6d 100644 (file)
@@ -1213,7 +1213,7 @@ class Article {
                # than the currently displayed one (e.g. image pages
                # craeted on file uploads); otherwise, link updates will 
                # go wrong.
-               $wgOut->addWikiText( $text, true, $this->mTitle );
+               $wgOut->addWikiTextWithTitle( $text, true, $this->mTitle );
 
                # Look up the links in the DB and add them to the link cache
                $wgOut->transformBuffer( RLH_FOR_UPDATE );
index 8b21f53..28f3b39 100644 (file)
@@ -227,16 +227,27 @@ class OutputPage {
 
        /**
         * Convert wikitext to HTML and add it to the buffer
+        * Default assumes that the current page title will
+        * be used.
         */
-       function addWikiText( $text, $linestart = true, &$titleObj=false ) {
-               global $wgParser, $wgTitle, $wgUseTidy;
-               $title = $titleObj ? $titleObj : $wgTitle;
+       function addWikiText( $text, $linestart = true ) {
+               global $wgTitle;
+               $this->addWikiTextTitle($text, $linestart, $wgTitle);
+       }
+
+       function addWikiTextWithTitle($text, $linestart = true, &$title) {
+               $this->addWikiTextTitle($text, $linestart, $title);
+       }
+       
+       function addWikiTextTitle($text, $linestart, &$title) {
+               global $wgParser, $wgUseTidy;
                $parserOutput = $wgParser->parse( $text, $title, $this->mParserOptions, $linestart );
                $this->mLanguageLinks += $parserOutput->getLanguageLinks();
                $this->mCategoryLinks += $parserOutput->getCategoryLinks();
                $this->addHTML( $parserOutput->getText() );
-       }
-
+       
+       }       
+               
        /**
         * Add wikitext to the buffer, assuming that this is the primary text for a page view
         * Saves the text into the parser cache if possible